package pen_exam.p_2024_04_07_smallredbook;

import java.util.Arrays;
import java.util.Scanner;

public class Code01_Fasn {
    public static class Node{
        int id;
        int save;
        int good;

        public Node(int id, int good, int save) {
            this.id = id;
            this.save = save;
            this.good = good;
        }
    }
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] nk = sc.nextLine().split(" ");
        int n = Integer.parseInt(nk[0]);
        int k = Integer.parseInt(nk[1]);
        Node[] fans = new Node[n];
        for(int i = 0;i < n;i++){
            String[] sg = sc.nextLine().split(" ");
            int g = Integer.parseInt(sg[0]);
            int s = Integer.parseInt(sg[1]) ;
            Node node = new Node(i + 1,g,s);
            fans[i] = node;
        }
        int[] res = new int[k];
        Arrays.sort(fans,(a,b) -> {
            int gradeA = a.good + (2 * a.save);
            int gradeB = b.good + (2 * b.save);
            return gradeA == gradeB ? (a.save == b.save ? (a.id - b.id) : (b.save - a.save)) : gradeB - gradeA;
        });
        for(int i = 0;i < k;i++){
            res[i] = fans[i].id;
        }
        Arrays.sort(res);
        for(int i = 0;i < k - 1;i++){
            System.out.print(res[i] + " ");
        }
        if(k > 0){
            System.out.print(res[k - 1]);
        }
    }
}
